$OpenBSD: patch-hot-babe_c,v 1.2 2014/09/16 18:57:32 espie Exp $
--- hot-babe.c.orig	Sun Dec  5 15:59:38 2004
+++ hot-babe.c	Tue Sep 16 12:56:16 2014
@@ -19,6 +19,13 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/sched.h>
+#include <sys/sysctl.h>
+#include <fcntl.h>
+#include <nlist.h>
+#endif
 #ifdef __FreeBSD__
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -99,6 +106,13 @@ static int system_cpu(void)
   long cp_time[CPUSTATES];
   size_t len = sizeof(cp_time);
 #endif
+#ifdef __OpenBSD__
+  long load, total, oload, ototal;
+  long ab, ac, ad, ae, af;
+  long cp_time[CPUSTATES];
+  size_t len = sizeof(cp_time);
+  static int mib[] = { CTL_KERN, KERN_CPTIME };
+#endif
 
 #ifdef __linux__
   stat = fopen("/proc/stat", "r");
@@ -114,6 +128,16 @@ static int system_cpu(void)
   ad = cp_time[CP_SYS];
   ae = cp_time[CP_IDLE];
 #endif
+#ifdef __OpenBSD__
+  if (sysctl(mib, 2, &cp_time, &len, NULL, 0) < 0) {
+          (void)fprintf(stderr, "Cannot get kern.cp_time");
+  }
+  ab = cp_time[CP_USER];
+  ac = cp_time[CP_NICE];
+  ad = cp_time[CP_SYS];
+  ae = cp_time[CP_IDLE];
+  af = cp_time[CP_INTR];
+#endif
 
 
   /* Find out the CPU load */
@@ -122,6 +146,10 @@ static int system_cpu(void)
   load = ab + ad;  /* cpu.user + cpu.sys; */
   if(!bm.noNice) load += ac;
   total = ab + ac + ad + ae;  /* cpu.total; */
+#ifdef __OpenBSD__
+  load += af;
+  total += af;
+#endif
 
   i = bm.loadIndex;
   oload = bm.load[i];
